package com.you.springcloudconfig.controller;

import com.springcloudconfig.feign.GoodsFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * Created by Linzk on 2020/12
 */
@RestController
// @RefreshScope // 开启刷新功能
@RequestMapping("/client-consumer")
public class ConfigClientConsumerController {

    @Autowired
    private RestTemplate restTemplate;

    @Autowired
    private GoodsFeignClient goodsFeignClient;

    @Autowired
    private DiscoveryClient discoveryClient; // 服务发现 动态获取 eureka server 路径

    // @Value("${name}")
    // private String name; // 获取远程 Gitee 仓库中配置的属性

    @RequestMapping("/config")
    public String getConfig() {
        String config = goodsFeignClient.getConfig();
        return "consumer: " + config;
    }



}
